#8=1
# def display_message(chapt):
#     print("i've learnt in " + chapt + " is how to define a function. ")
# display_message("chapt8")
#8-2
# def favourite_book(title):
#     print("one of my favourite books is " + title.title() + ".")
# #注意，实参一定要加双引号，代表一个字符串
# favourite_book("alice in wonderland")
#8-3
# def make_shirt(size, type):
#      print("you need a shirt, it's " + str(size) + " and " + type)
# # make_shirt(12, "long")
# # make_shirt(type="short", size=34)
# #8-4
# def make_shirt(size, type = "i love you"):
#     print("you need a shirt, it's " + str(size) + " and " + type)
# make_shirt("large")
# make_shirt("medium")
# make_shirt(type = "i hate you", size = 31)
#8-5
# def describe_city(name, country = "china"):
#     print(name.title() + " is in " + country.title())
# describe_city("hongkong")
# describe_city(name = "taiwan")
# describe_city(country = "japan", name = "tokyo")
#8-6
# def city_country(city, country):
#     result = city + ", " + country
#     return result.title()
# result1 = city_country("los", "america")
# result2 = city_country("tokyo", "japan")
# result3 = city_country("london", "british")
# print(result1)
# print(result2)
# print(result3)
#8-7
# def make_album(artist, album, song = " "):
#     info = {"artist": artist, "album": album}
#     if song:
#         info["song"] = song
#     return info
# dict1 = make_album("justin", "love")
# dict2 = make_album("beyonce","go", song = 3)
# dict3 = make_album("lily", "right")
# print(dict1)
# print(dict2)
# print(dict3)
#8-8
#break和false的效果不一样，break暴力结束完全不执行while下面的语言，false还会继续执行
# def make_album(artist, album):
#     info = {"artist": artist, "album": album}
#     return info
# message_request = True
# while message_request:
#     artist = input("what's the artist's name? ")
#     if artist == "no":
#         #false
#         break
#     album = input("what's album's name? ")
#     if album == "no":
#         #false
#         break
#     the_results = make_album(artist,album)
#     print(the_results)
#8-9
# def show_magicians(magicians):
	# for magician in magicians:
	    # print(magician.title())
# magician1 = show_magicians(["j", "k", "a"])
#8-10
# def make_great(magicians, new_magicians):
	# while magicians:
		# middle = "the great " + magicians.pop().title()
		# new_magicians.append(middle)
# def show_magicians(new_magicians):
	# for new_magician in new_magicians:
		# print(new_magician)
# magicians = ["j", "k", "l"]	
# new_magicians = []
# make_great(magicians, new_magicians)
# show_magicians(new_magicians)
#8-11非常重要需要理解的一部分
# def make_great(magicians, new_magicians):
	# while magicians:
		# middle = "the great " + magicians.pop().title()
		# new_magicians.append(middle)
# def show_magicians(new_magicians):
	# for new_magician in new_magicians:
		# print(new_magician)
# magicians = ["j", "k", "l"]	
# new_magicians = []
# make_great(magicians[:], new_magicians)
# show_magicians(new_magicians)
# print(magicians)
#8-12
# def list(*toppings):
	# for topping in toppings:
		# print("\nthis sandwich has: " + topping)
# list1 = list("onion")
# list2 = list("onion", "cheese")
# list3 = list("onion", "cheese", "tomato")
#8-13\14
def build_car(inventor, type, **car_info):
	profile = {}
	profile["inventor"] = inventor
	profile["type"] = type
	for key, value in car_info.items():
		profile[key] = value
	return profile
car = build_car("subaru", "outback",
                color = "blue",
                tow_package = True)
print(car)
                


	


